import request from '@/utils/request'


export function getNews(pageNum, pageSize) {
  return request({
    url: '/n/queryAllNews',
    method: 'get',
    params: { pageNum, pageSize }
  })
}

export function search(newsTitle) {
  return request({
    url: '/n/queryAllNews',
    method: 'get',
    params: newsTitle
  })
}

export function newsDetail(id) {
  return request({
    url: '/n/detailNews/'+ id,
    method: 'get',
  })
}

export function create(data) {
  return request({
    url: '/n/create',
    method: 'post',
    data
  })
}

export function update(id, views) {
  return request({
    url: '/n/update',
    method: 'post',
    params: {id, views}
  })
}

export function del(id){
  return request({
    url: '/n/delNews/'+id,
    method: 'get'
  })
}


